#sourcePath 是源文件路径#
#lib是目标文件
#include 是头文件查找目录
sourcePath=fairy
lib=$(libPath)/foptions.o $(libPath)/ffile.o $(libPath)/flexical.o $(libPath)/fsyntax.o
include=-Iinclude

#main是main文件路径
main=$(sourcePath)/main.cpp
std=-std=c++11
option=$(sourcePath)/foptions.cpp
ffile=$(sourcePath)/ffile.cpp
flexical=$(sourcePath)/flexical.cpp
fsyntax=$(sourcePath)/fsyntax.cpp

libPath=lib

take=g++ $(include) $(std)

start:$(lib) 
	$(take)  $(lib) $(main)
clear:
	rm -rf $(libPath)/*

$(libPath)/foptions.o:$(sourcePath)/foptions.cpp
	$(take) -c $(option) -o $(libPath)/foptions.o $(include)
$(libPath)/ffile.o:$(sourcePath)/ffile.cpp
	$(take) -c $(ffile) -o $(libPath)/ffile.o $(include)
$(libPath)/flexical.o:$(sourcePath)/flexical.cpp
	$(take) -c $(flexical) -o $(libPath)/flexical.o $(include)
$(libPath)/fsyntax.o:$(sourcePath)/fsyntax.cpp
	$(take) -c $(fsyntax) -o $(libPath)/fsyntax.o $(include)


#对单个源文件进行重新编译
alone:
	rm $(libPath)/$(file).o	
	#$(take) -c $(sourcePath)/$(file).cpp -o $(libPath)/$(file).o
